package com.bw.clock.net

import androidx.lifecycle.MutableLiveData
import com.bw.clock.entity.KaoqinData
import com.bw.common.vm.BaseViewModel
import com.bw.http.utils.zgr.OkHttpClientManager

class ClockViewModel:BaseViewModel() {
    val kaoCg by lazy { MutableLiveData<List<KaoqinData>>() }
    val api: ApiService = OkHttpClientManager.retrofitInstance.create(ApiService::class.java)

    fun kaoqin(userID:Int){
        executeNetwork(
            {api.getClick(userID)},
            kaoCg::postValue
        )
    }
    val addKaoqin by lazy { MutableLiveData<KaoqinData>() }
    fun addKaoqin(kaoqinData: KaoqinData){
        executeNetwork(
            {api.addClick(kaoqinData)},
            addKaoqin::postValue
        )
    }
}